package com.cqhfan.auth.interceptors;

import cn.hutool.core.util.StrUtil;
import com.cqhfan.core.constans.BizConstants;
import com.cqhfan.core.utils.UuidContextHolder;
import feign.RequestInterceptor;
import feign.RequestTemplate;

public class FeignReplyUserInfoInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate requestTemplate) {
        // 获取登录用户id
        String uuid = UuidContextHolder.getUuid();
        if (StrUtil.isBlank(uuid)) {
            return;
        }
        // 将用户id转发
        requestTemplate.header(BizConstants.TOKEN_LOGIN_INFO, uuid);
    }

}
